package phase1.part3.test;

import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.List;

import org.junit.Before;
import org.junit.Test;

import phase1.part3.TableWalker;
import phase1.part3.Token;

/**
 * 
 * 
 * @author John Girata
 * @version Nov 8, 2012
 */
public class TableWalkerTest2 {
	private TableWalker tw;

	@Before
	public void setup() throws Exception {
		tw = new TableWalker("../example/part2-sample_spec_simple-output.txt");
	}

	@Test
	public void test0() {
		List<Token> actual = tw.process("a = 10\nb = a*10 + 20");
		List<Token> expected = new ArrayList<>();

		expected.add(new Token("a", "IDENTIFIER"));
		expected.add(new Token("=", "EQUALS"));
		expected.add(new Token("10", "INT"));
		expected.add(new Token("b", "IDENTIFIER"));
		expected.add(new Token("=", "EQUALS"));
		expected.add(new Token("a", "IDENTIFIER"));
		expected.add(new Token("*", "MULT"));
		expected.add(new Token("10", "INT"));
		expected.add(new Token("+", "PLUS"));
		expected.add(new Token("20", "INT"));
		
		assertEquals(expected, actual);
	}
}
